package Luoguo;

import java.util.Scanner;

public class test2 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        long x = sc.nextLong();
        long n = sc.nextLong();
        long s=0;
        for (long i = 0; i < n; i++) {
            if(x!=6&&x!=7){
                s+=250;
            }
            if(x==7){
                x=1;
            }
            else{
                x++;
            }
        }
        System.out.println(s);
    }
}
